
export const ORG_STATUS = [
	{ label: '停用', value: 0 },
	{ label: '正常', value: 1 }
]

export const getTableColumns = ({ params }) => [
	{
		title: "组织名称",
		dataIndex: "name",
		width: 140,
		ellipsis: true
	},
	{
		title: "组织ID",
		dataIndex: "id",
		width: 140,
		ellipsis: true
	},
	{
		title: "显示顺序",
		dataIndex: "sort",
		width: 140,
		ellipsis: true
	},
	{
		title: "组织状态",
		dataIndex: "status",
		width: 140,
		ellipsis: true,
		render: (_: any, record: any) => {
			return (
				<span style={{}}>
					{ORG_STATUS.find(item => `${item.value}` === `${record.status}`)?.label}
				</span>
			)
		}
	},
	{
		title: "创建日期",
		dataIndex: "createTime",
		width: 100,
		ellipsis: true,
	},
];

export const COMMON_STATUS = [
	{ label: '停用', value: 0 },
	{ label: '正常', value: 1 }
]

export const getSearchColumns = () => [
	{
		type: "input",
		placeholder: "组织名称",
		name: "name"
	},
	{
		type: "select",
		placeholder: "组织状态",
		name: "status",
		options: COMMON_STATUS
	},
]

export const getCreateColumns = (orgTreeList: any) => {
	return [
		{
			type: "input",
			placeholder: "组织名称",
			label: "组织名称",
			name: "name",
			rules: [{ required: true, message: '这是必填项' }]
		},
		{
			type: "selectTree",
			placeholder: "父级组织",
			label: "父级组织",
			name: "parentId",
			request: () => orgTreeList,
			fieldProps: {
				treeDefaultExpandAll: true,
				showSearch: true,
				treeNodeFilterProp: 'title',
				fieldNames: {
					label: 'name',
					value: 'id',
					children: 'children',
				},
			}
		},
		{
			type: "input",
			placeholder: "排序",
			label: "排序",
			name: "sort",
		},
		{
			type: "radioGroup",
			placeholder: "状态",
			label: "状态",
			name: "status",
			options: ORG_STATUS,
		},
	]
}